<?php $this->load->view('common/header');?>
<body class="padding_top">
<!-- head [[-->
<div class="head_box">
	<div class="bank_nav">
        <a href="<?php echo site_url('order/order');?>"><i class="ico"></i></a>
    </div>
    <div class="head_title">请选择支付方式</div>
</div>
<!--]] head -->
<!-- info [[-->
<div class="pay_mask">
    <div class="content">
        <div class="sure_pay_price">
            <span>订单总金额：<em><?php echo $order['order_price'];?>元</em></span>
            <p><?php echo $notice;?></p>
        </div>
        <input type="hidden" value="<?php echo $order['order_no']; ?>" id="order_no" />
        <div class="the_way_pay">
            <ul>
                <li class="pay_type" action="1">
                    <span class="f_l">
                        <i class="ico ico_a"></i>
                        <em>销售贷支付</em>
                        <p>可用余额：<b><?php echo $member['user_money_real'];?>元</b></p>
                    </span>
                    <a href="#" class="f_r ico">&nbsp;</a>
                </li>
                <li class="pay_type" action="2">
                    <span class="f_l">
                        <i class="ico ico_a"></i>
                        <em>线下支付</em>
                        <p>请保持电话畅通，财务会在2小时内联系您</p>
                    </span>
                    <a href="#" class="f_r ico">&nbsp;</a>
                </li>
            </ul>
        </div>
        <div class="nav_box">
            <a href="javascript:;" id="order_pay">确定下单</a>
        </div>
    </div>
</div>
<script>
    // 提交
    $("#order_pay").on("click",function(){
        var pay_type = $(".pay_type.on").attr("action");
        var order_no = $("#order_no").val();
        var URL= baseurl+"index.php/order/pay_order";
        if(pay_type == "" || pay_type == null || pay_type == undefined){
            layer.msg("请选择支付类型");
            return false;
        }
        $.ajax({
            type: "post",
            url: URL,
            dataType:'json',
            data: {
                'pay_type':pay_type,
                'order_no':order_no,
                'csrf_test_name': ci_csrf_token()
            },
            success: function(data){
                if(data.status == 200){
                    window.location.href = data.url;
                }else if(data.status == 500){
                    layer.msg(data.msg, {
                        time: 1000, //1s后自动关闭
                        shade: 0.1
                    },function () {
                        window.location.href = data.url;
                    });
                }else{
                    layer.msg(data.msg);
                    return false;
                }

            }
        });
    });

    $(".pay_type").click(function () {
        $(this).addClass("on");
        $(this).siblings().removeClass("on");
    });
    $(".pay_type").click(function () {
        $(this).addClass("on");
        $(this).siblings().removeClass("on");
    });
</script>
<!--]] info -->
</body>
</html>
